#ifndef _C2C_ATOMIC_H
#define _C2C_ATOMIC_H

#include <stdlib.h>

#ifdef	__cplusplus
extern "C" {
#endif

u_int32_t atomic_cas32(volatile u_int32_t *mem, u_int32_t with, u_int32_t cmp);

u_int32_t atomic_add32(volatile u_int32_t *mem, u_int32_t val);

void atomic_sub32(volatile u_int32_t *mem, u_int32_t val);

int atomic_dec32(volatile u_int32_t *mem);

u_int32_t atomic_inc32(volatile u_int32_t *mem);

void atomic_set32(volatile u_int32_t *mem, u_int32_t val);

u_int32_t atomic_read32(volatile u_int32_t *mem);

u_int32_t atomic_xchg32(volatile u_int32_t *mem, u_int32_t val);

#ifdef  __cplusplus
}
#endif

#endif


